package cn.bellychang.ood.litejunit.v3.framework.request;

import cn.bellychang.ood.litejunit.v3.framework.runner.Runner;
import cn.bellychang.ood.litejunit.v3.framework.runners.CompositeRunner;

/**
 * @author ChangLiang
 * @date 2020/5/28
 */
public class ClassesRequest extends Request {

    private final Class[] fClasses;

    private final String fName;

    public ClassesRequest(String name, Class... classes) {
        fClasses = classes;
        fName = name;
    }

    @Override
    public Runner getRunner() {
        CompositeRunner runner= new CompositeRunner(fName);
        for (Class<?> each : fClasses) {
            Runner childRunner= Request.aClass(each).getRunner();
            if (childRunner != null) {
                runner.add(childRunner);
            }
        }
        return runner;
    }
}
